package com.climb.spingcloud.convert;

import com.climb.spingcloud.dto.UserDto;
import com.climb.spingcloud.entity.User;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface UserConvert {
	UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);

	User dto2entity(UserDto orderDto);
	@Mappings({
			@Mapping(source="id", target="id"),
			@Mapping(source="userName", target="userName"),
			@Mapping(source="password", target="password"),
			@Mapping(source="telephone", target="telephone"),
			@Mapping(source="photo", target="photo"),
			@Mapping(source="birthday", target="birthday", dateFormat="yyyy-MM-dd HH:mm:ss")
	})
	UserDto entity2dto(User order);
	List<UserDto> entityList2dtoList(List<User> orders);
	List<User> dtoList2entityList(List<UserDto> orderDtos);
}